<?php

namespace app\admin\model\rebate;

use think\Model;


class Logs extends Model
{

    

    

    // 表名
    protected $name = 'rebate_logs';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [

    ];
    

    
    // 记录单个订单返利
    public static function logRebate($batchId, $orderId, $userId, $period, $scheduled, $actual, $isManual)
    {
        return self::create([
            'batch_id' => $batchId,
            'order_id' => $orderId,
            'user_id' => $userId,
            'period' => $period,
            'scheduled_points' => $scheduled,
            'actual_points' => $actual,
            'is_manual' => $isManual,
            'triggered_at' => date('Y-m-d H:i:s'), // 添加触发时间
        ]);
    }






}
